package IC.AST.nodes;

import IC.AST.*;

/**
 * a variable declaration statement
 */
public class VarDeclStmt extends Statement {
	private Type type;	// the variable type
	private String id;	// the variable name
	private Expression init;	// the initiallization (may be null)

	/**
	 * @param type the variable type
	 * @param id the variable name
	 * @param init the initiallization (may be null)
	 * @param line the node line number
	 * @param column the node column number
	 */
	public VarDeclStmt(Type type, String id, Expression init, int line, int column) {
		super(line,column);
		this.type = type;
		this.id = id;
		this.init = init;
	}

	/**
	 * @return the variable type
	 */
	public Type getType() {
		return this.type;
	}

	/**
	 * @return the variable name
	 */
	public String getId() {
		return this.id;
	}

	/**
	 * @return the initiallization (may be null)
	 */
	public Expression getInit() {
		return this.init;
	}

	public Object accept(Visitor v) {
		return v.visit(this);
	}
}
